﻿using ConsoleApp1.Model;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Net;
using ConsoleApp1.DB;
using HtmlAgilityPack;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.PhantomJS;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
                //DB.DBContext.MakeModels();
            BaseRepository<AvInfo> a = new BaseRepository<AvInfo>();
            var s = a.Find();
            Console.WriteLine(s.ToList().Count);
            if (args.Length != 2 & args.Length!=0)
            {
                throw new ArgumentException("参数个数错误！");
                return;
            }
            int startpage = 1;
            int endpage = 491;

            if (args.Length>=2 &&(!int.TryParse(args[0],out startpage) || !int.TryParse(args[1], out endpage)|| startpage<=0 || endpage<=0))
            {
                throw new ArgumentException("参数类型错误！");
            }
            if (endpage < startpage)
            {
                throw new ArgumentException("结束页不能小于起始页！");
            }
            
            AvNo1Spider.run(startpage,endpage);
            



        }

    }
  
        
}
